<?php
if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"]))
	return false;    // serve the requested resource as-is.
else { 
	include substr($_SERVER['REQUEST_URI'],1) . '.php';
}

